<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    #box{
      width: 200px;
      height: 200px;
      background-color: rgb(135, 192, 97);
      margin: 10px auto;
    }
    #box2{
      width: 200px;
      height: 200px;
      background-color: rgb(36, 26, 179);
      margin: 10px auto;
    }
  </style>
</head>
<body>
  <div id="app">
    <button @click="isShow = !isShow">{{isShow?'隐藏':'显示'}}</button>
    {{ isShow }}
    <div id="box" v-if="isShow">111</div>
    <div id="box2" v-else>222</div>
  </div>
  <script src="./vue.js"></script>
  <script>
      const vm = new Vue({
        // 绑定vm到 视图上， 定义vm控制视图的范围
        el: '#app',
        data: {
          isShow: true
        }
      })
  </script>
</body>
</html>